package cn.akwangl.spring.dependency.inject;

import cn.akwangl.spring.dependency.inject.model.UserHolder;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * Autowiring By Constructor
 *
 * @author youyongkun
 * @date 2021/7/18 9:53 上午
 */
public class AutowiringByConstructorXmlDependencyConstructorInjectDemo {

    public static void main(String[] args) {
        DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(beanFactory);

        String location = "classpath:/META-INF/autowiring-dependency-constructor-inject.xml";
        xmlReader.loadBeanDefinitions(location);

        UserHolder userHolder = beanFactory.getBean(UserHolder.class);

        System.out.println(userHolder);
    }



}
